home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / utilwb / mf4fxdsk.lha / fax_for_MTerm4.0 / source / faxGUI.c < prev    next >
C/C++ Source or Header  |  1996-05-03  |  8KB  |  356 lines

  1. #ifndef MAKE_ID
  2. #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
  3. #endif
  4.  
  5. /* Libraries */
  6. #include <libraries/mui.h>
  7. #include <libraries/gadtools.h> /* for Barlabel in MenuItem */
  8. #include <exec/memory.h>
  9.  
  10. /* Prototypes */
  11. #include <proto/muimaster.h>
  12. #include <clib/exec_protos.h>
  13. #include <clib/alib_protos.h>
  14.  
  15. #include "faxGUI.h"
  16.  
  17. static char *GetMBString(APTR ref)
  18. {
  19.     char *aux;
  20.  
  21.     aux = GetFaxString(ref);
  22.     if (aux[1] == '\0') return(&aux[2]);
  23.     else                return(aux);
  24. }
  25.  
  26. struct ObjApp * CreateApp(void)
  27. {
  28.     struct ObjApp * Object;
  29.  
  30.     APTR    MNlabel1Projekt, MNlabel1ber, MNlabel1BarLabel0, MNlabel1Beenden;
  31.     APTR    GROUP_ROOT_0, IM_label_1, GR_grp_1, GR_grp_4, Space_4, GROUP_ROOT_1;
  32.     APTR    GR_grp_2, Space_2, GR_grp_3, Space_0, Space_1, Space_3;
  33.  
  34.     if (!(Object = AllocVec(sizeof(struct ObjApp),MEMF_PUBLIC|MEMF_CLEAR)))
  35.         return(NULL);
  36.  
  37.     Object->STR_TX_ueber = GetMBString(MSG_TX_ueber);
  38.  
  39.     IM_label_1 = ImageObject,
  40.         MUIA_Image_Spec, "5:schrifft.iff",
  41.         MUIA_Image_FreeVert, TRUE,
  42.         MUIA_Image_FreeHoriz, TRUE,
  43.         MUIA_FixHeight, 25,
  44.         MUIA_FixWidth, 130,
  45.     End;
  46.  
  47.     Object->BT_Printer = SimpleButton(GetMBString(MSG_BT_Printer));
  48.  
  49.     Object->BT_Spooler = SimpleButton(GetMBString(MSG_BT_Spooler));
  50.  
  51.     Object->BT_Logbook = SimpleButton(GetMBString(MSG_BT_Logbook));
  52.  
  53.     Object->BT_Config = SimpleButton(GetMBString(MSG_BT_Config));
  54.  
  55.     Object->BT_Desktop = SimpleButton(GetMBString(MSG_BT_Desktop));
  56.  
  57.     Object->BT_Phone = SimpleButton(GetMBString(MSG_BT_Phone));
  58.  
  59.     GR_grp_1 = GroupObject,
  60.         MUIA_Frame, MUIV_Frame_Button,
  61.         MUIA_Group_Columns, 3,
  62.         MUIA_Group_SameSize, TRUE,
  63.         MUIA_Group_HorizSpacing, 10,
  64.         MUIA_Group_VertSpacing, 5,
  65.         Child, Object->BT_Printer,
  66.         Child, Object->BT_Spooler,
  67.         Child, Object->BT_Logbook,
  68.         Child, Object->BT_Config,
  69.         Child, Object->BT_Desktop,
  70.         Child, Object->BT_Phone,
  71.     End;
  72.  
  73.     Object->BT_View = SimpleButton(GetMBString(MSG_BT_View));
  74.  
  75.     Space_4 = HSpace(20);
  76.  
  77.     Object->BT_End = SimpleButton(GetMBString(MSG_BT_End));
  78.  
  79.     GR_grp_4 = GroupObject,
  80.         MUIA_Frame, MUIV_Frame_Button,
  81.         MUIA_Group_Horiz, TRUE,
  82.         Child, Object->BT_View,
  83.         Child, Space_4,
  84.         Child, Object->BT_End,
  85.     End;
  86.  
  87.     GROUP_ROOT_0 = GroupObject,
  88.         MUIA_Group_SameWidth, TRUE,
  89.         Child, IM_label_1,
  90.         Child, GR_grp_1,
  91.         Child, GR_grp_4,
  92.     End;
  93.  
  94.     MNlabel1ber = MenuitemObject,
  95.         MUIA_Menuitem_Title, GetMBString(MSG_MNlabel1ber),
  96.         MUIA_Menuitem_Shortcut, GetMBString(MSG_MNlabel1berChar),
  97.     End;
  98.  
  99.     MNlabel1BarLabel0 = MUI_MakeObject(MUIO_Menuitem, NM_BARLABEL, 0, 0, 0);
  100.  
  101.     MNlabel1Beenden = MenuitemObject,
  102.         MUIA_Menuitem_Title, GetMBString(MSG_MNlabel1Beenden),
  103.         MUIA_Menuitem_Shortcut, GetMBString(MSG_MNlabel1BeendenChar),
  104.     End;
  105.  
  106.     MNlabel1Projekt = MenuitemObject,
  107.         MUIA_Menuitem_Title, GetMBString(MSG_MNlabel1Projekt),
  108.         MUIA_Family_Child, MNlabel1ber,
  109.         MUIA_Family_Child, MNlabel1BarLabel0,
  110.         MUIA_Family_Child, MNlabel1Beenden,
  111.     End;
  112.  
  113.     Object->MN_label_1 = MenustripObject,
  114.         MUIA_Family_Child, MNlabel1Projekt,
  115.     End;
  116.  
  117.     Object->Fax_Win = WindowObject,
  118.         MUIA_Window_Title, GetMBString(MSG_Fax_Win),
  119.         MUIA_Window_Menustrip, Object->MN_label_1,
  120.         MUIA_Window_ID, MAKE_ID('0', 'W', 'I', 'N'),
  121.         WindowContents, GROUP_ROOT_0,
  122.     End;
  123.  
  124.     Object->TX_ueber = TextObject,
  125.         MUIA_Background, MUII_TextBack,
  126.         MUIA_Frame, MUIV_Frame_Text,
  127.         MUIA_Text_Contents, Object->STR_TX_ueber,
  128.         MUIA_Text_PreParse, "\033c\0338",
  129.         MUIA_Text_SetMin, TRUE,
  130.     End;
  131.  
  132.     Space_2 = VSpace(10);
  133.  
  134.     Space_0 = HSpace(75);
  135.  
  136.     Object->BT_OK = SimpleButton(GetMBString(MSG_BT_OK));
  137.  
  138.     Space_1 = HSpace(75);
  139.  
  140.     GR_grp_3 = GroupObject,
  141.         MUIA_Group_Columns, 3,
  142.         Child, Space_0,
  143.         Child, Object->BT_OK,
  144.         Child, Space_1,
  145.     End;
  146.  
  147.     Space_3 = VSpace(10);
  148.  
  149.     GR_grp_2 = GroupObject,
  150.         Child, Object->TX_ueber,
  151.         Child, Space_2,
  152.         Child, GR_grp_3,
  153.         Child, Space_3,
  154.     End;
  155.  
  156.     GROUP_ROOT_1 = GroupObject,
  157.         MUIA_Background, MUII_ListBack,
  158.         Child, GR_grp_2,
  159.     End;
  160.  
  161.     Object->Info_Win = WindowObject,
  162.         MUIA_Window_Title, GetMBString(MSG_Info_Win),
  163.         MUIA_Window_ID, MAKE_ID('1', 'W', 'I', 'N'),
  164.         MUIA_Window_SizeGadget, FALSE,
  165.         WindowContents, GROUP_ROOT_1,
  166.     End;
  167.  
  168.     Object->App = ApplicationObject,
  169.         MUIA_Application_Author, "Jürgen Späth",
  170.         MUIA_Application_Base, "Multifax",
  171.         MUIA_Application_Title, "Multifax-Desk",
  172.         MUIA_Application_Version, "$VER: Version 1.9 (27.04.1996)",
  173.         MUIA_Application_Copyright, GetMBString(MSG_AppCopyright),
  174.         MUIA_Application_Description, GetMBString(MSG_AppDescription),
  175.         SubWindow, Object->Fax_Win,
  176.         SubWindow, Object->Info_Win,
  177.     End;
  178.  
  179.  
  180.     if (!Object->App)
  181.     {
  182.         FreeVec(Object);
  183.         return(NULL);
  184.     }
  185.  
  186.     DoMethod(MNlabel1ber,
  187.         MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
  188.         Object->Info_Win,
  189.         3,
  190.         MUIM_Set, MUIA_Window_Open, TRUE
  191.         );
  192.  
  193.     DoMethod(MNlabel1ber,
  194.         MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
  195.         Object->Info_Win,
  196.         3,
  197.         MUIM_Set, MUIA_Window_ActiveObject, MUIV_Window_ActiveObject_Next
  198.         );
  199.  
  200.     DoMethod(MNlabel1ber,
  201.         MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
  202.         Object->Info_Win,
  203.         3,
  204.         MUIM_Set, MUIA_Window_Activate, TRUE
  205.         );
  206.  
  207.     DoMethod(MNlabel1Beenden,
  208.         MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
  209.         Object->Info_Win,
  210.         3,
  211.         MUIM_Set, MUIA_Window_Open, FALSE
  212.         );
  213.  
  214.     DoMethod(MNlabel1Beenden,
  215.         MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
  216.         Object->Fax_Win,
  217.         3,
  218.         MUIM_Set, MUIA_Window_Open, FALSE
  219.         );
  220.  
  221.     DoMethod(MNlabel1Beenden,
  222.         MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
  223.         Object->App,
  224.         2,
  225.         MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit
  226.         );
  227.  
  228.     DoMethod(Object->Fax_Win,
  229.         MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
  230.         Object->Fax_Win,
  231.         3,
  232.         MUIM_Set, MUIA_Window_Open, FALSE
  233.         );
  234.  
  235.     DoMethod(Object->Fax_Win,
  236.         MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
  237.         Object->App,
  238.         2,
  239.         MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit
  240.         );
  241.  
  242.     DoMethod(Object->BT_Printer,
  243.         MUIM_Notify, MUIA_Pressed, FALSE,
  244.         Object->App,
  245.         2,
  246.         MUIM_Application_ReturnID, BT_PRINTER
  247.         );
  248.  
  249.     DoMethod(Object->BT_Spooler,
  250.         MUIM_Notify, MUIA_Pressed, FALSE,
  251.         Object->App,
  252.         2,
  253.         MUIM_Application_ReturnID, BT_SPOOLER
  254.         );
  255.  
  256.     DoMethod(Object->BT_Logbook,
  257.         MUIM_Notify, MUIA_Pressed, FALSE,
  258.         Object->App,
  259.         2,
  260.         MUIM_Application_ReturnID, BT_LOGBOOK
  261.         );
  262.  
  263.     DoMethod(Object->BT_Config,
  264.         MUIM_Notify, MUIA_Pressed, FALSE,
  265.         Object->App,
  266.         2,
  267.         MUIM_Application_ReturnID, BT_CONFIG
  268.         );
  269.  
  270.     DoMethod(Object->BT_Desktop,
  271.         MUIM_Notify, MUIA_Pressed, FALSE,
  272.         Object->App,
  273.         2,
  274.         MUIM_Application_ReturnID, BT_DESK
  275.         );
  276.  
  277.     DoMethod(Object->BT_Phone,
  278.         MUIM_Notify, MUIA_Pressed, FALSE,
  279.         Object->App,
  280.         2,
  281.         MUIM_Application_ReturnID, BT_PHONE
  282.         );
  283.  
  284.     DoMethod(Object->BT_View,
  285.         MUIM_Notify, MUIA_Pressed, FALSE,
  286.         Object->App,
  287.         2,
  288.         MUIM_Application_ReturnID, BT_VIEW
  289.         );
  290.  
  291.     DoMethod(Object->BT_End,
  292.         MUIM_Notify, MUIA_Pressed, FALSE,
  293.         Object->Info_Win,
  294.         3,
  295.         MUIM_Set, MUIA_Window_Open, FALSE
  296.         );
  297.  
  298.     DoMethod(Object->BT_End,
  299.         MUIM_Notify, MUIA_Pressed, FALSE,
  300.         Object->Fax_Win,
  301.         3,
  302.         MUIM_Set, MUIA_Window_Open, FALSE
  303.         );
  304.  
  305.     DoMethod(Object->BT_End,
  306.         MUIM_Notify, MUIA_Pressed, FALSE,
  307.         Object->App,
  308.         2,
  309.         MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit
  310.         );
  311.  
  312.     DoMethod(Object->Fax_Win,
  313.         MUIM_Window_SetCycleChain, Object->BT_Printer,
  314.         Object->BT_Spooler,
  315.         Object->BT_Logbook,
  316.         Object->BT_Config,
  317.         Object->BT_Desktop,
  318.         Object->BT_Phone,
  319.         Object->BT_View,
  320.         Object->BT_End,
  321.         0
  322.         );
  323.  
  324.     DoMethod(Object->BT_OK,
  325.         MUIM_Notify, MUIA_Pressed, FALSE,
  326.         Object->Info_Win,
  327.         3,
  328.         MUIM_Set, MUIA_Window_Open, FALSE
  329.         );
  330.  
  331.     DoMethod(Object->BT_OK,
  332.         MUIM_Notify, MUIA_Pressed, FALSE,
  333.         Object->Fax_Win,
  334.         3,
  335.         MUIM_Set, MUIA_Window_Activate, TRUE
  336.         );
  337.  
  338.     DoMethod(Object->Info_Win,
  339.         MUIM_Window_SetCycleChain, Object->BT_OK,
  340.         0
  341.         );
  342.  
  343.     set(Object->Fax_Win,
  344.         MUIA_Window_Open, TRUE
  345.         );
  346.  
  347.  
  348.     return(Object);
  349. }
  350.  
  351. void DisposeApp(struct ObjApp * Object)
  352. {
  353.     MUI_DisposeObject(Object->App);
  354.     FreeVec(Object);
  355. }
  356.